package com.next.muscu.visual;

import java.awt.Component;

import javax.swing.JLabel;
import javax.swing.JTree;
import javax.swing.tree.DefaultTreeCellRenderer;

import com.next.muscu.data.Exo;
import com.next.muscu.data.ExoTypeExo;

public class ExoTypeExoTreeCellRender extends DefaultTreeCellRenderer {

	@Override
	public Component getTreeCellRendererComponent(JTree arg0, Object arg1,
			boolean arg2, boolean arg3, boolean arg4, int arg5, boolean arg6) {
		// TODO Auto-generated method stub
		JLabel lab = (JLabel) super.getTreeCellRendererComponent(arg0, arg1, arg2, arg3, arg4, arg5,
				arg6);
		if(arg1 instanceof ExoTypeExo)
		{ 
			ExoTypeExo e = (ExoTypeExo) arg1;
			lab.setText(e.getCode() +":"+e.getName());
		}
		else if(arg1 instanceof Exo)
		{
			Exo e = (Exo) arg1;
			lab.setText(e.getCode() +":"+e.getDescription());
		}
		return lab;
	}

}
